package com.jeesite.modules.dp.service.patternstatics;

import com.jeesite.modules.dp.dto.vo.MarkViewPieRecord;
import com.jeesite.modules.dp.dao.patrernstatics.YearHighSectorDistributeDao;
import com.jeesite.modules.dp.entity.patrernstatics.YearHighSectorDistributeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YearHighSectorDistributeService {

    @Autowired
    private YearHighSectorDistributeDao yearHighSectorDistributeDao;

    public List<MarkViewPieRecord> getDistributePieDatas() {
        List<YearHighSectorDistributeEntity> list = yearHighSectorDistributeDao.getLatestDataList();
        return list.stream().map(item -> new MarkViewPieRecord(item.getSectorName(),
                item.getPercentage())).toList();
    }
}
